#ifndef SILO_PACKET_H
#define SILO_PACKET_H
#include "FlashStorage.h"
#define LOW_POWER_LISTENING
//#define SYNC_AT_START

enum
{
	SILO_DATA_AMID = 0xA1,
	SILO_CMD_AMID = 0xB1,
};

enum
{
	MODE_FW,
	MODE_STORE,
	MODE_GSM
};

enum
{
	CMD_STORAGE_INFO = 0x21,
	CMD_DUMP = 0x22,
	CMD_ERASE = 0x23,
	
	CMD_MODE_FW = 0x10,
	CMD_MODE_STORE = 0x11,
	CMD_TRIGGER_INTERVAL = 0x12,
	CMD_MODE_GSM = 0x13,
	CMD_TRIGGER = 0x14,
	
	CMD_PING = 0x31,
	CMD_LPL_SET = 0x32,
};

typedef nx_struct
{
	nx_uint32_t timestamp;
	nx_uint16_t temp;
	nx_uint16_t humid;
	nx_uint16_t voltage;
} silo_data_t;

typedef nx_struct
{
	nx_uint16_t dst;
	nx_uint8_t cmd;
}serial_cmd_msg_t;

typedef nx_struct
{
	nx_uint16_t dst;
	nx_uint8_t cmd;
	nx_uint16_t wakeup;
	nx_uint16_t delay;
}serial_cmd_lpl_msg_t;

typedef nx_struct
{
	nx_uint16_t dst;
	nx_uint8_t cmd;
	nx_uint32_t address;
	nx_uint32_t count;
}serial_cmd_storagedump_msg_t;

typedef nx_struct
{
	nx_uint16_t dst;
	nx_uint8_t cmd;
	storage_info_t info;
}serial_cmd_storageinfo_msg_t;

typedef nx_struct
{
	nx_uint16_t dst;
	nx_uint8_t cmd;
	nx_uint32_t interval;
}serial_cmd_msg_interval_t;

typedef nx_struct
{
	nx_uint8_t cmd;
}cmd_msg_t;

typedef nx_struct
{
	nx_uint8_t cmd;
	nx_uint16_t wakeup;
	nx_uint16_t delay;
}cmd_lpl_msg_t;

typedef nx_struct
{
	nx_uint8_t cmd;
}sim900_cntrl;



#endif /* SILO_PACKET_H */
